#!/bin/sh

BINARY_FILE=EasyReson
#root dir
DIR="$( cd "$( dirname "$0"  )" && pwd  )"
#log file
CURRENT_LOG=${DIR}/logs/easyReson.log
#server_pid
SERVER_HAS_PID=$(ps aux|grep ${BINARY_FILE} |grep -v grep|awk '{print $2}')

if [ -n "${SERVER_HAS_PID}" ]; then
	echo "${BINARY_FILE} is already running ! pid : ${SERVER_HAS_PID}"
else
	nohup ./${BINARY_FILE} >/dev/null 2>&1 &
	echo "${BINARY_FILE} is started successfully,pid :$!"
	echo "getting some logs ......"
	sleep 7
    tail -n30 ${CURRENT_LOG}
	echo "ok!"
fi
